package com.nondo.dean.platform.service;

import com.nondo.dean.auth.common.TokenPrincipalProvider;
import com.nondo.dean.platform.domain.PlatformUser;
import com.nondo.dean.platform.mapper.PlatformUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author xiaofan
 * @Description: 平台用户管理业务类
 * @throws
 * @date 2018-05-0213:59
 * @Version 0.1
 */
@Component
public class PlatFormUserService {

    @Autowired
    private PlatformUserMapper platformUserMapper;

    @Autowired
    private TokenPrincipalProvider tokenPrincipalProvider;

    /**
     * 查询平台用户对应的sap账号
     * @return
     */
    public String querySapAccount(){

        Integer id = tokenPrincipalProvider.getTokenPrincipal().getUserId().intValue();
        PlatformUser platformUser = platformUserMapper.selectByPrimaryKey(id);
        return platformUser.getSapAccount();
    }

}
